]>
Commit | Line | Data |
---|---|---|
f8aec187 BB |
1 | using System; |
2 | using System.Collections.Generic; | |
3 | using System.Linq; | |
4 | using System.Text; | |
5 | using Microsoft.Xna.Framework; | |
6 | using Microsoft.Xna.Framework.Graphics; | |
7 | using Microsoft.Xna.Framework.Content; | |
8 | ||
9 | namespace SuperPolarity | |
10 | { | |
11 | static class ActorFactory | |
12 | { | |
2af83e98 | 13 | static internal Game Game; |
f8aec187 BB |
14 | |
15 | static public MainShip CreateMainShip(Vector2 position) | |
16 | { | |
2af83e98 BB |
17 | MainShip mainShip = new MainShip(Game); |
18 | mainShip.Initialize(Game.Content.Load<Texture2D>("Graphics\\main-ship"), position); | |
f8aec187 BB |
19 | |
20 | ActorManager.CheckIn(mainShip); | |
21 | ||
22 | return mainShip; | |
23 | } | |
24 | ||
2af83e98 | 25 | static public StandardShip CreateShip(Ship.Polarity polarity, Vector2 position) |
f8aec187 | 26 | { |
2af83e98 BB |
27 | StandardShip ship = new StandardShip(Game); |
28 | Texture2D texture; | |
29 | ||
30 | if (polarity == Ship.Polarity.Positive) | |
31 | { | |
32 | texture = Game.Content.Load<Texture2D>("Graphics\\positive-ship"); | |
33 | } | |
34 | else if (polarity == Ship.Polarity.Negative) | |
35 | { | |
36 | texture = Game.Content.Load<Texture2D>("Graphics\\negative-ship"); | |
37 | } | |
38 | else | |
39 | { | |
40 | texture = Game.Content.Load<Texture2D>("Graphics\\neutral-ship"); | |
41 | } | |
42 | ||
43 | ship.Initialize(texture, position); | |
44 | ship.SetPolarity(polarity); | |
45 | ||
46 | ActorManager.CheckIn(ship); | |
47 | ||
48 | return ship; | |
49 | } | |
50 | ||
51 | internal static void SetGame(Game game) | |
52 | { | |
53 | ActorFactory.Game = game; | |
f8aec187 BB |
54 | } |
55 | } | |
56 | } |